Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pretty-print SMT queries #3679

Merged
merged 2 commits into from
Feb 10, 2025
Merged

Pretty-print SMT queries #3679

merged 2 commits into from
Feb 10, 2025

Conversation

gebner
Copy link
Contributor

@gebner gebner commented Jan 15, 2025

This makes it easier to read the logged SMT queries without formatting them first. It also avoids the asymptotically quadratic string concatenation.

 ;;; Fact-ids: Name Prims.int; Namespace Prims
-(assert (! (forall ((@u0 Fuel) (@x1 Term))
- (! (implies (HasTypeFuel @u0
-@x1
-Prims.int)
-(is-BoxInt @x1))
-
-
-:pattern ((HasTypeFuel @u0
-@x1
-Prims.int))
-:qid int_inversion))
-:named int_inversion))
+(assert
+ (! (forall ((@u0 Fuel) (@x1 Term))
+   (! (implies (HasTypeFuel @u0 @x1 Prims.int) (is-BoxInt @x1))
+    :pattern ((HasTypeFuel @u0 @x1 Prims.int))
+    :qid int_inversion))
+  :named int_inversion))

As Nik suggested, I tried running this on deeply nested SMT queries from PulseCore. As expected, the indentation sometimes becomes large enough that the output contains one word per line. On PulseCore.IndirectionTheorySep there is a 10% increase in file size. To reduce the impact, I am only increasing the indentation by one space every time.

@gebner gebner force-pushed the gebner_pprint_smt branch from b850e9c to 329a2b2 Compare January 15, 2025 20:36
@mtzguido mtzguido enabled auto-merge February 9, 2025 23:54
@mtzguido mtzguido merged commit aa34464 into master Feb 10, 2025
17 checks passed
@mtzguido mtzguido deleted the gebner_pprint_smt branch February 10, 2025 00:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants